//
//  HSellerCollectionViewCell.swift
//  VastSwift
//
//  Created by BestVast on 2021/5/30.
//

import UIKit

/// 热卖精选cell
class HSellerCell: UICollectionViewCell {
    
    func uiConfig() {
        self.backgroundColor = .white
        self.contentView.addSubview(logoImage)
        self.contentView.addSubview(titleLabel)
        self.contentView.addSubview(lineView)
        self.contentView.addSubview(buyButton)
        
        logoImage.frame = CGRect.init(x: 0, y: 0, width: self.frame.size.width, height: self.frame.size.width)
        logoImage.backgroundColor = .orange
        lineView.frame = CGRect.init(x: 0, y: self.frame.size.height - 50, width: self.frame.size.width, height: 1)
        titleLabel.frame = CGRect.init(x: 10, y: self.frame.size.height - 49, width: self.frame.size.width - 15, height: 20)
        buyButton.frame = CGRect.init(x: 10, y: self.frame.size.height - 25, width: 80, height: 16)
        
    }
    
        
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        uiConfig()
        self.layer.cornerRadius = 5
        self.layer.masksToBounds = true
        self.layer.borderColor = colorTheme.cgColor
        self.layer.borderWidth = 1
        
    }
    // 顶部商品图片
    lazy var logoImage: UIImageView = {
        let logoImage = UIImageView.init()
        return logoImage
    }()
    // 中间线
    lazy var lineView: UIView = {
        let lineView = UIView.init()
        lineView.backgroundColor = .gray
        return lineView
    }()
    // 商品名称
    lazy var titleLabel: UILabel = {
        let titleLabel = UILabel.init()
        titleLabel.textAlignment = .left
        titleLabel.textColor = .black
        titleLabel.backgroundColor = .white
        titleLabel.font = .systemFont(ofSize: 16)
        return titleLabel
    }()
    // 购买按钮
    lazy var buyButton: UIButton = {
        let buyButton = UIButton.init(type: .custom)
        buyButton.layer.cornerRadius = 5
        buyButton.layer.masksToBounds = true
        buyButton.layer.borderWidth = 1
        buyButton.layer.borderColor = colorTheme.cgColor
        buyButton.setTitle("点击购买", for: .normal)
        buyButton.setTitleColor(colorTheme, for: .normal)
        buyButton.setTitleColor(.gray, for: .highlighted)
        buyButton.titleLabel?.font = .systemFont(ofSize: 14)
        return buyButton
    }()
    
    
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
